// src/api/userRoles.js
import request from '@/utils/request'

/**
 * 获取某个用户已分配的角色
 * GET /api/admin/user-roles/{userId}
 */
export const getUserRoles = (userId) => {
    return request.get(`/admin/user-roles/${userId}`)
}

/**
 * 给用户分配角色
 * POST /api/admin/user-roles
 * body: { userId: number, roleIds: number[] }
 */
export const assignUserRoles = ({ userId, roleIds }) => {
    return request.post('/admin/user-roles', { userId, roleIds })
}
export const listAllRoles = () => {
    return request.get('/admin/roles')
}
